load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test", "go_source")

test_suite(
    name = "cross",
)

go_binary(
    name = "windows_cross",
    srcs = ["main.go"],
    goarch = "amd64",
    goos = "windows",
    pure = "on",
)

go_binary(
    name = "linux_cross",
    srcs = ["main.go"],
    goarch = "amd64",
    goos = "linux",
    pure = "on",
)

go_binary(
    name = "darwin_cross",
    srcs = ["main.go"],
    goarch = "amd64",
    goos = "darwin",
    pure = "on",
)

go_test(
    name = "cross_test",
    size = "small",
    srcs = ["cross_test.go"],
    rundir = ".",
    data = [
        ":darwin_cross",
        ":linux_cross",
        ":windows_cross",
    ],
    deps = ["//go/tools/bazel:go_default_library"],
    args = [
        "-darwin", "$(location :darwin_cross)",
        "-linux", "$(location :linux_cross)",
        "-windows", "$(location :windows_cross)",
    ]
)
